import request from '@/utils/request'
import { API_CONFIG } from '@/api/config'

// 查询品牌列表
export function listBrand(query) {
  const params = {
    ...query,
    orgId: API_CONFIG.ORG_ID
  }
  return request({
    url: '/fun/brand/list',
    method: 'get',
    params: params
  })
}

// 查询品牌详细
export function getBrand(brandId) {
  return request({
    url: '/mobile/product/brand/' + brandId,
    method: 'get',
    params: {
      orgId: API_CONFIG.ORG_ID
    }
  })
}

// 新增品牌
export function addBrand(data) {
  const requestData = {
    ...data,
    orgId: API_CONFIG.ORG_ID
  }
  return request({
    url: '/fun/brand',
    method: 'post',
    data: requestData
  })
}

// 修改品牌
export function updateBrand(data) {
  const requestData = {
    ...data,
    orgId: API_CONFIG.ORG_ID
  }
  return request({
    url: '/fun/brand',
    method: 'put',
    data: requestData
  })
}

// 删除品牌
export function delBrand(brandId) {
  return request({
    url: '/fun/brand/' + brandId,
    method: 'delete',
    params: {
      orgId: API_CONFIG.ORG_ID
    }
  })
}